Skip to content

Add new MinimalVideoPlayer component - #1425

Merged
rezrah merged 18 commits into
mainfrom
danielguillan/add-minimal-video-player-component
Aug 11, 2026
Merged

Add new MinimalVideoPlayer component#1425
rezrah merged 18 commits into
mainfrom
danielguillan/add-minimal-video-player-component

Conversation

@danielguillan

@danielguillan danielguillan commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Resolves https://github.com/github/brand-experience/issues/383
Resolves #1437

Adds MinimalVideoPlayer, a lightweight component for short, silent videos (illustrations, product demos) that only need a play and pause control.

The component is always muted, plays inline, and hides native video controls. Automatic playback is viewport-aware and respects reduced-motion preferences.

List of notable changes:

  • added the new MinimalVideoPlayer component
  • added viewport-aware playback that pauses offscreen video and only resumes playback that was not paused manually
  • added reduced-motion handling that suppresses and stops automatic playback while preserving manual controls
  • added customizable accessible play and pause labels, native video attributes, event handlers, source children, and forwarded ref support

What should reviewers focus on?

  • Verify the autoplay, viewport visibility, manual pause, looping, and reduced-motion behavior.
  • Check that the control state, accessible labels, forwarded ref, and native video event handlers remain synchronized with playback.

Steps to test:

  1. Open the Storybook preview.
  2. Verify the default video plays while visible and the control toggles between play and pause.
  3. Scroll the playing video out of view and back into view; verify it pauses and resumes.
  4. Pause the video manually, scroll it out of view and back, and verify it remains paused.
  5. Enable reduced motion, reload the story, and verify the video does not autoplay but can still be played manually.
  6. Review the MinimalVideoPlayer page in the Next.js docs preview.

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there are not other open Pull Requests for the same update/change

Screenshots:

add-minimal-video-player-component primer-brand localhost_1355__path=_story_components-minimalvideoplayer-features--native-source-element

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6bedd99

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@primer/react-brand Minor
@primer/brand-docs Minor
@primer/brand-css Minor
@primer/brand-primitives Minor
@primer/brand-e2e Minor
@primer/brand-fonts Minor
@primer/brand-mcp Minor
@primer/brand-config Minor
@primer/brand-storybook Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

🟢 No design token changes found

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🟢 Bundle size report

CheckMainBranchChange
UMD — full bundle (JS)101.97 kB102.63 kB⬆️ +683 B (+0.7%)
UMD — full bundle (CSS)67.96 kB68.11 kB⬆️ +161 B (+0.2%)
ESM — full bundle (JS + CSS)1.59 MB1.60 MB⬆️ +9.95 kB (+0.6%)
ESM — tree-shaken simple (Button)71.14 kB71.35 kB⬆️ +209 B (+0.3%)
ESM — tree-shaken complex (ActionMenu)80.10 kB80.31 kB⬆️ +214 B (+0.3%)

@github-actions

Copy link
Copy Markdown
Contributor

🟢 Unit test coverage changes found

Unit test coverage has been updated through this PR.

Changes: 1 new tests, 0 removed tests, 0 improved, 0 decreased

Component/Hook Statements Functions Branches Change
MinimalVideoPlayer 100.0% 100.0% 100.0% NEW

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

⚠️ Visual differences found

Our visual comparison tests found UI differences.

Please review the differences by using the test artifacts to ensure that the changes were intentional.

Artifacts can be downloaded and reviewed locally.

Download links are available at the bottom of the workflow summary screen.

Example:

artifacts section of workflow run

If the changes are expected, please run npm run test:visual:update to replace the previous fixtures.

Review visual differences

@danielguillan
danielguillan marked this pull request as ready for review July 28, 2026 09:19
@danielguillan
danielguillan requested a review from a team as a code owner July 28, 2026 09:19
Copilot AI review requested due to automatic review settings July 28, 2026 09:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new MinimalVideoPlayer React component to @primer/react-brand for muted, inline, minimal-control video playback with viewport-aware autoplay and reduced-motion support, and integrates it into the FlexSuite AI Overview hero media.

Changes:

  • Introduces MinimalVideoPlayer (component, styles, hook) with viewport-based autoplay/pause/resume and reduced-motion handling.
  • Adds unit tests, Storybook stories, and visual snapshots/tests for the new component.
  • Updates FlexSuite AI Overview to use the new video component (plus localized play/pause strings) and stabilizes related visual tests via reduced-motion emulation.
Show a summary per file
File Description
packages/react/src/recipes/Flexsuite/Overview/Overview.visual.spec.ts Emulates reduced motion to keep the AI Overview visual snapshot stable with video media.
packages/react/src/recipes/Flexsuite/Overview/FlexSuiteAIOverview.tsx Swaps hero image for hero video using MinimalVideoPlayer.
packages/react/src/recipes/Flexsuite/Overview/FlexSuiteAIOverview.content.ts Adds localized play/pause strings for the new hero video control labels.
packages/react/src/MinimalVideoPlayer/useMinimalVideoPlayback.ts Implements viewport-aware autoplay/pausing and reduced-motion behavior.
packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.visual.spec.ts Visual regression coverage for paused/narrow stories.
packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.tsx New component implementation (muted, inline, hidden native controls, overlay play/pause button).
packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.test.tsx Unit + a11y tests covering autoplay, viewport behavior, reduced motion, and event handler passthrough.
packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.stories.tsx Default + Playground stories for Storybook controls.
packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.module.css.d.ts Generated CSS module typings for the new component.
packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.module.css Styles for layout and the overlay control (including forced-colors handling).
packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.features.stories.tsx Feature stories (native <source>, paused/playing, custom labels, narrow viewport).
packages/react/src/MinimalVideoPlayer/index.ts Public barrel export for the new component.
packages/react/src/index.ts Exposes MinimalVideoPlayer from the package root.
packages/e2e/scripts/playwright/playwright.generate-tests.ts Adjusts visual test generation: reduced-motion overrides + skips for nondeterministic/autoplaying stories.
apps/storybook/static/locales/pt-BR/FlexSuiteOverview.json Adds localized play/pause labels for FlexSuite Overview hero video controls.
apps/storybook/static/locales/ja/FlexSuiteOverview.json Adds localized play/pause labels for FlexSuite Overview hero video controls.
apps/storybook/static/locales/fr/FlexSuiteOverview.json Adds localized play/pause labels for FlexSuite Overview hero video controls.
apps/storybook/static/locales/es/FlexSuiteOverview.json Adds localized play/pause labels for FlexSuite Overview hero video controls.
apps/storybook/static/locales/en/FlexSuiteOverview.json Adds localized play/pause labels for FlexSuite Overview hero video controls.
apps/storybook/static/locales/de/FlexSuiteOverview.json Adds localized play/pause labels for FlexSuite Overview hero video controls.
apps/next-docs/content/components/MinimalVideoPlayer/index.mdx Adds documentation page with usage and accessibility guidance.
.changeset/calm-videos-play.md Changeset announcing the new component in @primer/react-brand (minor).

Review details

  • Files reviewed: 21/28 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread packages/react/src/MinimalVideoPlayer/useMinimalVideoPlayback.ts Outdated
Comment thread packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.test.tsx
Comment thread packages/react/src/MinimalVideoPlayer/MinimalVideoPlayer.tsx

@danielguillan danielguillan Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jesussandreas, please note that we are still using the old play icon here. It will be automatically replaced by the new one you provided as soon as Octicons is updated and we upgrade the dependency in Primer Brand.


const defaultTimeout = 500 // Storybook 7 introduced a small delay in loading stories. This is to migigate the spinner showing up in screenshots.

const reducedMotionLookup = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for posterity, this should be done using NODE_ENV with a test value. That'll swap out the video with a static poster for VRT.

@rezrah
rezrah merged commit a486555 into main Aug 11, 2026
18 checks passed
@rezrah
rezrah deleted the danielguillan/add-minimal-video-player-component branch August 11, 2026 17:00
@primer primer Bot mentioned this pull request Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [BUG] - Video play / pause brand refactor mismatch

3 participants